﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


using System.Threading;
using System.IO;
using EzDesk.Utility;
using System.Xml.Xsl;

namespace EzDesk.Clients.Utility
{
    class Program
    {
        static string xmlDataUri = "translatetestfile\\ezdeskfeed.xml";
        static string xmlData = string.Empty;
        static string htmlXsltUri= "EzDesk.Clients.Utility.TranslateTestFile.FeedTemplate.html.xslt";
        static string xamlXsltUri = "EzDesk.Clients.Utility.TranslateTestFile.FeedTemplate.xaml.xslt";
        static void Main(string[] args)
        {
            xmlData = File.ReadAllText(xmlDataUri);

            TestTransform("", "html");
            TestTransform(xamlXsltUri,"xaml");
            Console.ReadKey();
        }

        static void TestTransform(string xsltUri,string targetType)
        {
            var items = FeedCollection.Create(xmlData, targetType);
            
            var sb = new StringBuilder();
            items.Foreach(model => sb.Append(model.TransformedData));
            Console.WriteLine(sb.ToString());

            File.WriteAllText(targetType + ".txt", sb.ToString());
        }
    }
}
